package cn.dw.dao.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import cn.dw.dao.PeopleDao;
import cn.dw.domain.People;

public class PeopleDaoImpl extends BaseDaoImpl<People> implements PeopleDao {
	@SuppressWarnings("unchecked")
	public People getByUserName(String username) {
		DetachedCriteria dc = DetachedCriteria.forClass(People.class);
		dc.add(Restrictions.eq("username", username));
		List<People> list = getHt().findByCriteria(dc);
		return (list != null) && (list.size() > 0) ? (People) list.get(0) : null;
	}
}
